<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 捕获全局reject抛出的错误异常
        // window.addEventListener('unhandledrejection', function (e) {
        //     console.log(e);
        // });
        // 捕获全局所有抛出的错误异常
        window.onerror = function (e) {
            console.log(e);
        }
        new Promise((resolve, reject) => {
            setTimeout(() => {
                reject(new Error('error...'));
                // throw new Error('error...')
            }, 1000);
        }).catch((e) => {
            console.log(e);
        })
        console.log(1);




    </script>
</body>

</html>